#! /bin/bash
export LANG=zh_CN.UTF-8
PRESTO_HOME=/export/server/presto/bin/presto


${PRESTO_HOME} --catalog hive --server 192.168.88.80:8090 --execute "

-- mysql 删表
DROP TABLE if exists edu_olap_online.ads_attendance_count;
DROP TABLE if exists edu_olap_online.ads_late_count;
DROP TABLE if exists edu_olap_online.ads_leave_count;
DROP TABLE if exists edu_olap_online.ads_absent_count;

-- presto CTAS
create table mysql.edu_olap_online.ads_attendance_count as(
select * from hive.edu_online_ads.ads_attendance_count
);

create table mysql.edu_olap_online.ads_late_count as(
select * from hive.edu_online_ads.ads_late_count
);

create table mysql.edu_olap_online.ads_leave_count as(
select * from hive.edu_online_ads.ads_leave_count
);

create table mysql.edu_olap_online.ads_absent_count as(
select * from hive.edu_online_ads.ads_absent_count
);"